<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>创业者服务首页</title>
		<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css"/>
		<link rel="stylesheet" type="text/css" href="../css/style.css"/>
		<link rel="stylesheet" href="../css/leftSidebar.css">
	</head>
	<style type="text/css">
		html,body{height: 100%;padding-bottom: 50px;}
		.col-xs-12.nav_right{padding: 0;height: 100px;padding-right: 0;margin-right: 0;min-width: 1100px;height: 100px;padding-right: 0;margin-right: 0;padding-left: 160px;}
		#myTab a{color: #7c7c7c;  font-size: 15px;}
		#myTab>li.active>a{color: #3f4142; background-color: #fff;}
		.navbar-form{margin-top: 0;}
		.tab_creat .active{color:#6bc50d;}
		.table>tbody>tr.active>td, .table>tbody>tr.active>th, .table>tbody>tr>td.active, .table>tbody>tr>th.active, .table>tfoot>tr.active>td, .table>tfoot>tr.active>th, .table>tfoot>tr>td.active, .table>tfoot>tr>th.active, .table>thead>tr.active>td, .table>thead>tr.active>th, .table>thead>tr>td.active, .table>thead>tr>th.active{background-color: #fff;}
		.table>tfoot>tr.active>td{background-color: #fff;}
		.table>tbody>tr>td{border-top:0;}
		.table{margin-bottom: 0;}
		div.tab_creat.row{background-color: #fff;}
		.tab_font{padding: 10px 0;}
		.tab_font div,.tab_font td{font-size: 14px;  color: #919191;}
		.gongsi_list div.col-xs-2{padding-top:10px;padding-bottom: 10px;text-align: center;}
		.gongsi_list.row{padding: 20px;background-color: #fff;margin-top: 20px;border: 1px solid #ddd;}
		.gongsi_list dd div.col-xs-2{height: 60px;line-height: 60px;font-size: 14px;  color: #4f5051;}
		.row{margin: 0;	}
		
		.sub_logo{position: relative;display: inline-block;padding-left: 0;}
		.sub_logo input{opacity: 0;position: absolute;width: 100%;top: 0;bottom: 0;}
		.zhube_head{border-bottom: 1px solid #ddd;}
		.zhube_head h3{padding: 5px 0;,  color: #222c38;font-size: 16px;border-bottom: 4px solid #5a626d;}
			
		#form_test1 label,#form_test2 label{font-size: 14px;  color: #515151;font-weight: normal;}
		#form_test1  .media-middle,#form_test2  .media-middle{font-size: 14px;color: #acacac;}
		.form_tip{font-size: 12px;color: #acacac;  }
		.btn-default{border-color: #d4252a;color: #d4252a;}
		.btn-default.disabled{background-color: #ccc;color: #fff;border-color:#ccc;}
		.btn-default.disabled.focus, .btn-default.disabled:focus, .btn-default.disabled:hover, .btn-default[disabled].focus, .btn-default[disabled]:focus, .btn-default[disabled]:hover, fieldset[disabled] .btn-default.focus, fieldset[disabled] .btn-default:focus, fieldset[disabled] .btn-default:hover{background-color: #ccc;color: #fff;}
		.btn_next{width: 180px;margin-top: 30px;}
		.btn_next,.btn_back{margin-bottom: 50px;}

		.form-group .xiangmuInfo{color: #f00;}

		.checkbox-inline.col-xs-3{margin-left: 10px;padding-bottom: 20px;}

	.backBtn{position: absolute;bottom: 150px;left: 30px}
	.backBtn a{width: 80px;background-color: #0a628f;color: #ccc;border-color:#0a628f; }
	</style>

	<body style="background-color: #f2f2f2;">
		<div class="row warp" style="height: 100%;">
			<div class="nav_right_head">
				<a href="../index.html"><img src="../img/roleIndexBg.jpg"/></a>
			</div>
			<!--左侧导航-->
			<div class="col-xs-2 nav_left">
				<div class="creatNav">创业者服务</div>
				<div class="creatLoginStatus"><img src="../img/avtar.png"><a>您好，创业者</a></div>
				<div class="list-group" style="padding: 0;">
					<a href="cyzfw_index.html" class="list-group-item "><i class="glyphicon glyphicon-home"></i> 首页</a>
					<a href="cyzfw_zuche.html" class="list-group-item "><i class="glyphicon glyphicon-plus-sign"></i> 注册项目</a>
					<a href="cyzfw_myProgress.html" class="list-group-item active"><i class="glyphicon glyphicon-folder-open"></i> 我的项目</a>
					<a href="cyzfw_mynews.html" class="list-group-item"><i class="glyphicon glyphicon-book"></i> 我的消息</a>
					<div class="list-group listAttention">
						<div class="list-group-item" > <span class="caret"></span> 我的关注</div>
						<a href="cyzfw_gz_touziren.html" class="list-group-item"><i class="glyphicon glyphicon-usd"></i> 投资人/机构</a>
						<a href="cyzfw_gz_daoshi.html" class="list-group-item"><i class="glyphicon glyphicon-user"></i> 导师</a>
						<a href="cyzfw_gz_xiangmu.html" class="list-group-item"><i class="glyphicon glyphicon-lock"></i> 项目</a>
					</div>

				</div>
				<div class="backBtn"> <a href="../index.html"><img src="../img/backIndex.png"></a></div>
			</div>

			<div class="col-xs-12 nav_right">

					<div class="row" style="margin-top: 10px;">
						<div class="col-xs-8 col-xs-offset-2  zhuche_progress1" >
							<div class="zhube_head clearfix">
								<h3 class="pull-left">基本信息</h3>
							</div>

							<!--<iframe name="testIframeName" id="callbackFram" style=""></iframe>-->
							<form class="form-horizontal" id="form_test1"  style="padding: 20px 0;"  enctype="multipart/form-data">
							  <div class="form-group">
							    <label for="pbName" class="col-sm-3 control-label"><span class="xiangmuInfo">*</span>项目名称</label>
							    <div class="col-sm-8">
							      <input type="text"  name='pbName' class="form-control" id="pbName" placeholder="输入项目名称"  >
							    </div>
							  </div>
							  <div class="form-group">
							    <label for="company" class="col-sm-3 control-label">工商注册公司全称</label>
							    <div class="col-sm-8">
							      <input type="text" name="company" class="form-control" id="company"   placeholder="输入公司全称公司全称" >
							    </div>
							  </div>
							   <div class="form-group">
							    <label for="pic" class="col-sm-3 control-label">项目logo</label>
							    <div class="col-sm-8">
							    	<div class="sub_logo">
							    		<button class=" btn btn-default">上传logo</button>
							    		<input type="file" name="pic" id="pic" value="" />
							    	</div>
							    <span class="media-middle">图片清晰完整，与公司简历保持一致</span>
							    </div>
							  </div>
							   <div class="form-group">
							    <label for="synopsis" class="col-sm-3 control-label"><span class="xiangmuInfo">*</span>项目一句话简介</label>
							    <div class="col-sm-8">
							      <input type="text" class="form-control" id="synopsis" name="synopsis"  maxlength="30" placeholder="一句话介绍产品与服务，30字内">
							    </div>
							  </div>
							  <div class="form-group">
							    <label for="keyword" class="col-sm-3 control-label"><span class="xiangmuInfo">*</span>技术关键字</label>
							    <div class="col-sm-8">
							      <input type="text" class="form-control" id="keyword" name="keyword"   placeholder="关键字之间以逗号隔开">
							    </div>
							  </div>
							  <div class="form-group">
							    <label for="financing" class="col-sm-3 control-label"><span class="xiangmuInfo">*</span>融资规模</label>
							    <div class="col-sm-8">
							      <input type="text" class="form-control" id="financing" name="financing"  placeholder="请输入您计划的融资规模"  >
							    </div>
							  </div>
							  <div class="form-group">
							    <label for="personNum" class="col-sm-3 control-label"><span class="xiangmuInfo">*</span>项目人数</label>
							    <div class="col-sm-8">
							      <input type="text" class="form-control" id="personNum" name="personNum"  placeholder="请输入项目人数" datatype="*" nullmsg="不能为空" >
							    </div>
							  </div>
							  <div class="form-group">
							    <label for="stageProject" class="col-sm-3 control-label"><span class="xiangmuInfo">*</span>项目阶段</label>
							    <div class="col-sm-8">
							     <select class="form-control" id="stageProject" name="stageProject" value="" >

									</select>
							    </div>
							  </div>

							  <div class="form-group">
							    <label for="financingStage" class="col-sm-3 control-label"><span class="xiangmuInfo">*</span>融资阶段</label>
							    <div class="col-sm-8">
							     <select class="form-control" id="financingStage" name="financingStage" value="" >

									</select>
							    </div>
							  </div>

							  <div class="form-group">
							    <label for="area" class="col-sm-3 control-label"><span class="xiangmuInfo">*</span>地区</label>
							    <div class="col-sm-8">
							     <select class="form-control" id="area" name="area" value="" >
									</select>
							    </div>
							  </div>
							<div class="form-group">
								<div class="row">
									<h5 class="col-xs-3 text-right">投资领域</h5>
								</div>

							<div class="row " style="padding-bottom: 20px;padding-left: 20px;">
								<div class="col-xs-offset-3 " id="area_out">

								</div>

							</div>

							<input type="hidden" name="domain" id="domain"  value="" />
							  </div>

							  <div class="form-group">
							    <label for="yixing" class="col-sm-3 control-label">是否参加熠星大赛</label>
							    <div class="col-sm-8">
							     <select class="form-control" id="yixing" name="yixing" >
									  <option value="1">是</option>
									  <option value="0">否</option>
									</select>
							    </div>
							  </div>
							  <div class="form-group">
							    <label for="needTutor" class="col-sm-3 control-label">是否需要老师辅导</label>
							    <div class="col-sm-8">
							     <select class="form-control" name="needTutor" id="needTutor">
									  <option value="1">是</option>
									  <option value="0">否</option>
									</select>
							    </div>
							  </div>

							  <div class="form-group">
							    <label for="xiangmuChat" class="col-sm-3 control-label">项目概述</label>
							    <div class="col-sm-8">
							      <textarea class="form-control" id="xiangmuChat" name="summary" rows="3" placeholder="可拆分未产品描述、用户群体、项目愿景、竞争对手等方面描述，不超多1000字"></textarea>
							    </div>
							  </div>
							    <div class="form-group">
							    <label for="projectRole" class="col-sm-3 control-label"><span class="xiangmuInfo">*</span>	项目角色</label>
							    <div class="col-sm-8">
							      <select class="form-control" name="projectRole" id="projectRole" >
									  <option >团队创始人</option>
									  <option>团队成员</option>
									  <option>其他</option>
									</select>
							    </div>
							  </div>
							   <div class="form-group">
							    <label for="book" class="col-sm-3 control-label">商业计划书</label>
							    <div class="col-sm-8">
							    	<div class="sub_logo">
							    		<button class=" btn btn-default">上传文件</button>
							    		<input type="file" name="book"  id="book" value="" />
							    	</div>
							    <span class="media-middle"><a href="#">商业计划书模板</a></span>
							    </div>
							  </div>


							  <div class="form-group">
							    <label for="" class="col-sm-3 control-label">项目介绍ppt</label>
							    <div class="col-sm-8">
							    	<div class="sub_logo">
							    		<button class=" btn btn-default">上传文件</button>
							    		<input type="file" name="book"  id="" value="" />
							    	</div>
							    </div>
							  </div>


							  <div class="form-group">
							    <label for="" class="col-sm-3 control-label">项目介绍视频</label>
							    <div class="col-sm-8">
							    	<div class="sub_logo">
							    		<button class=" btn btn-default">上传介绍视频</button>
							    		<input type="file" name="book"   value="" />
							    	</div>
							    </div>
							  </div>



							  <div class="form-group">
							    <label for="" class="col-sm-3 control-label">项目详情是否公开</label>
							    <div class="col-sm-8">
							      <select class="form-control" id="open_" name="open">
									  <option value="1">是</option>
									  <option value="0">否</option>
									</select>
							    </div>
							  </div>
							  <input type="hidden" name="userId" id="userId" value="" />
							  <div class="form_tip">注意：为了保证审核效率，请仔细检查结果中需要添加的</div>
								<input type="button" class="btn btn-default center-block btn_next" value="提交修改"/>
							</form>
						</div>
			</div>
		</div>

	</div>
		<div class="modal fade bs-example-modal-sm" id="myModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
			<div class="modal-dialog modal-sm" role="document">
				<div class="modal-content">
					修改失败
				</div>
			</div>
		</div>
	</body>
	<script src="../js/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="../js/bootstrap.min.js" ></script>
	<script type="text/javascript" src="../js/Validform_v5.3.2_min.js" ></script>
	<script type="text/javascript" src="../js/uploadimg.js" ></script>
	<script type="text/javascript" src="../js/jquery-form.js" ></script>
	<script type="text/javascript" src="../js/public.js"></script>
	<script type="text/javascript">


	 var person = JSON.parse(sessionStorage.getItem("person"));
		if (person==''||person==null) {
			alert('请先登录')
			 window.location.href='denglu.html';
		} else{
			 var userId=person.userid;
//$.ajax({
//	          url: 'http://114.112.96.184:18080/auth/toStartup' ,
//	          type: 'get',
//	          data: {'userId':userId},
//	          async: false,
//	          success: function (data) {
//	           console.log(data);
//	           if(data.result < 0){
//	           window.location.href='cyzfw_renzheng.html';
//	           }
//	           if(data.result == 0){
//	           		 window.location.href='cyzfw_renzheng.html';
//	           }
//	           if (data.result == null) {
//	           	 window.location.href='cyzfw_renzheng.html';
//	           }
//
//	          },
//	          error: function (returndata) {
//
//	          }
//	     });

		 }
	 var id = location.href.split('?')[1];
	console.log(userId)
	// 判断用户是否认证


	 $.ajax({
		 url: 'http://114.112.96.184:18080/startup/toUpdate/'+id,
		 type: 'get',
		 data: {'userId':userId},
		 async: false,
		 success: function (data) {
			 console.log(data);
			 var obj = data.result;
//			 $('#pic').val(obj.logo)
			 $("#area").find("option[value='"+obj.area+"']").attr("selected",true);
			 $("#financingStage").find("option[value='"+obj.financingStage+"']").attr("selected",true);
			 $("#open").find("option[value='"+obj.open+"']").attr("selected",true);
			 $("#point").find("option[value='"+obj.point+"']").attr("selected",true);
			 $("#stageProject").find("option[value='"+obj.stageProject+"']").attr("selected",true);
			 $("#yixing").find("option[value='"+obj.yixing+"']").attr("selected",true);
			 $("#businessPlan").val(obj.businessPlan);
			 var domain = obj.domain.split(',');
			 for (var i = 0; i<domain.length;i++){
//			 	console.log($("input[value='"+domain[i]+"']"))
				 $('#area_out').find("input[value='"+domain[i]+"']").attr('checked', 'true');
//				 console.log($('#area_out').find("input[value='"+domain[i]+"']"))
			 }


			 $("#financing").val(obj.financing);
			 $("#keyword").val(obj.keyword);
//			 $("#logo").val(obj.logo);
			 $("#pbName").val(obj.pbName);
			 $("#personNum").val(obj.personNum);
			 $("#summary").val(obj.summary);
			 $("#synopsis").val(obj.synopsis);
			 $("#company").val(obj.company);

		 },
		 error: function (returndata) {

		 }
	 });





	 $('#userId').val(userId);

 $("#up").uploadPreview({ Img: "ImgPr", Width: 120, Height: 120 });
		$("#form_test1").Validform({
		btnSubmit:".btn_next",
		beforeCheck:function(curform){
			var domains = '';
			 $('input[name="areas"]:checked').each(function(){
			   domains+=$(this).val()+','
			  });
			domains=domains.substring(0,domains.length-1);
			  $('#domain').val(domains)
		},
		beforeSubmit:function(curform){
			doUpload()
		return false;
		},
			callback:function(data){
				console.log(data)

//		var obj=data.result;
//		var userId=obj.id;
			}


	});



function doUpload() {
     var formData = new FormData($( "#form_test1" )[0]);
     $.ajax({
          url: 'http://192.168.100.123:8081/startup/pb/'+id+'?userId='+userId,
          type: 'put',
          data: formData,
          async: false,
          cache: false,
          contentType: false,
          processData: false,
          success: function (data) {
           console.log(data);
           if (data.code==000) {
           	window.location.href='cyzfw_myProgress.html'
           } else{
           	$('#myModal').modal('toggle')
           }

          },
          error: function (returndata) {
              console.log(returndata);
          }
     });

}  

//		地区	
	$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/area",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= "<option value=" + obj[i].id +" >"+ obj[i].value  +"</option>"
                   }
                   $('#area').html(htmls);
                }
            });
            
            
//          项目阶段
			$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/startupStage",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= "<option value=" + obj[i].id +" >"+ obj[i].value  +"</option>"
                   }
                   $('#stageProject').html(htmls);
                }
            });

//		领域
			$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/field",
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	
                   	htmls+= '<label class="checkbox-inline col-xs-3"><input type="checkbox" name="areas"  value="'+ obj[i].id +'">'+obj[i].value+'</label>'
                   }
                   $('#area_out').html(htmls);
                }
            });
            
            //	融资阶段
			$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/financingStage",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= "<option value=" + obj[i].id +" >"+ obj[i].value  +"</option>"
                   }
                   $('#financingStage').html(htmls);
                }
            });




	</script>
	
	
</html>
